<template>
  <div id="recommend">
    <com-head :opacity="0">我的推荐</com-head>
    <div class="recommend">
      <div class="box1">{{profit}}</div>
      <div class="box2">
        <p>我的好友人数</p>
        <p>{{number}}</p>
      </div>
      <div class="box3">
        <p>历史总收益（元）</p>
        <p>{{money}}</p>
      </div>
    </div>
    <div class="sellTop">
      <span>推荐明细</span>
    </div>
    <div class="list">
      <div class="item title">
        <span>用户名</span>
        <span>关注时间</span>
      </div>
      <div class="item" v-for="(item,index) in list" :key="index">
        <span>{{item.wx_name}}</span>
        <span>{{item.add_time}}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "recommend",
  data() {
    return {
      profit: "0",
      number: "0",
      money: "0",
      list: [
        {
          name: "",
          time: ""
        },
        {
          name: "",
          time: ""
        }
      ]
    };
  },

  computed: {},

  created() {},

  mounted() {
    this.loading();
  },

  methods: {
    loading() {
      this.axios
        .post("user/recdetail", {
          token: this.token()
        })
        .then(({ data }) => {
          console.log(data);
          if (data.code === "200") {
            this.profit = data.dayprice.toFixed(2);
            this.number = data.number;
            this.money = Number(data.price).toFixed(2);
            this.list = data.data;
          } else if (data.code === "201") {
            this.$bus.$emit("toast", data.data);
          }
        })
        .catch(function(error) {
          console.log(error);
        });
    }
  }
};
</script>
<style lang='scss' scoped>
#recommend {
  .recommend {
    width: 750px;
    height: 798px;
    background: url("../assets/image/profitbg.png") no-repeat;
    background-size: contain;
    position: relative;
    text-align: center;
    .box1 {
      font-size: 56px;
      font-family: PingFangSC-Medium;
      font-weight: 600;
      color: rgba(255, 255, 255, 1);
      position: absolute;
      top: 40%;
      left: 50%;
      transform: translate(-50%, -20%);
    }
    .box2 {
      width: 200px;
      font-size: 28px;
      color: rgba(255, 255, 255, 0.9);
      line-height: 40px;
      position: absolute;
      bottom: 100px;
      left: 15%;
      p:nth-of-type(2) {
        font-size: 56px;
        font-weight: 600;
        line-height: 80px;
      }
    }
    .box3 {
      width: 250px;
      font-size: 28px;
      color: rgba(255, 255, 255, 0.9);
      line-height: 40px;
      position: absolute;
      bottom: 100px;
      right: 15%;
      p:nth-of-type(2) {
        font-size: 56px;
        font-weight: 600;
        line-height: 80px;
      }
    }
  }
  .sellTop {
    margin: 0 32px;
    display: flex;
    justify-content: space-between;
    align-content: center;
    line-height: 84px;
    position: relative;
    span {
      color: #333333;
    }
    span:nth-of-type(1) {
      font-weight: 700;
    }
    &:after {
      content: "";
      height: 28px;
      width: 2px;
      background: #222;
      position: absolute;
      left: -8px;
      top: 27px;
    }
  }
  .list {
    .item {
      display: flex;
      justify-content: space-around;
      align-items: center;
      line-height: 80px;
      font-size: 28px;
      color: #222;
      span {
        width: 348px;
        text-align: center;
      }
    }
    .title {
      color: #888;
    }
  }
}
</style>